package com.ita.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import sun.nio.cs.ext.SJIS;

@Entity
@Table(name="food_type")
@GenericGenerator(strategy = "uuid", name = "uid")
public class FoodType {
	
	@Id
//	@GeneratedValue(generator = "uid")
	private String id;
	@Column(name = "type", nullable = false, insertable = true/* false表示不能插入 */, updatable = true/* 可被更新 */, unique = true)
	private String name;
	
//	@OneToMany(mappedBy = "type", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
//	private Set<Food> foods = new HashSet<Food>();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public FoodType() {
		super();
	}
	
	
	@Override
	public String toString() {
		return "FoodType [id=" + id + ", name=" + name + "]";
	}

//	public Set<Food> getFoods() {
//		return foods;
//	}
//
//	public void setFoods(Set<Food> foods) {
//		this.foods = foods;
//	}

	public FoodType(String id, String name) {
		super();
		this.id = id;
		this.name = name;
	}
		
}
